/*
 * Copyright (c) 2003
 * XDoclet Team
 * All rights reserved.
 */
package org.xdoclet.plugin.qtags.impl;

import org.generama.QDoxCapableMetadataProvider;
import org.generama.VelocityTemplateEngine;
import org.generama.WriterMapper;

import org.generama.defaults.JavaGeneratingPlugin;

import org.xdoclet.plugin.qtags.QTagUtils;

/**
 * Produces implementation classes for xdoclet tag handling out of interfaces
 * marked with qtags. behavour of implementation classes is controlled by qtags
 * also ( see qtags documentation for details ). Due to naming coflict with
 * qtags and templating  engines, "name" and "class" tag parameters shallk be specified as getName()_ and getClass_()
 * on qtag interface. Qtag name for use in javadocs is created by changing camelhump
 * in hyphenated version. Thus interface FooBarBaz will produce qtag \@foo.bar-baz
 *.
 * @author Aslak Helles&oslash;y
 * @author Konstantin Pribluda
 * @version $Revision: 332 $
 */
public class QTagImplPlugin extends JavaGeneratingPlugin {
    private QTagUtils qTagUtils = new QTagUtils();

    public QTagImplPlugin(VelocityTemplateEngine velocityTemplateEngine, QDoxCapableMetadataProvider metadataProvider,
        WriterMapper writerMapper) {
        super(velocityTemplateEngine, metadataProvider, writerMapper);
        setFileregex("\\.java");
        setFilereplace("Impl.java");
        setMultioutput(true);
        qTagUtils.registerLibrary(metadataProvider);
    }

    public QTagUtils getQTagUtils() {
        return qTagUtils;
    }

    public boolean shouldGenerate(Object metadata) {
        return qTagUtils.shouldGenerate(metadata);
    }
}